home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / ada / gnat-3.05- / gnat-3 / gnat-3.05-i486-linux-elf-bin / examples / test_cl.adb < prev    next >
Encoding:
Text File  |  1996-06-11  |  797 b   |  27 lines

  1. with Ada.Command_Line;
  2. with Gnat.Io; use Gnat.Io;
  3.  
  4. procedure Test_CL is
  5. begin
  6.    --  Writes out the command name (argv[0])
  7.    Put ("      The command name : ");
  8.    Put (Ada.Command_Line.Command_Name);
  9.    New_Line;
  10.  
  11.    --  Writes out the number of arguments passed to the program (argc)
  12.    Put ("The number of arguments: ");
  13.    Put (Ada.Command_Line.Argument_Count);
  14.    New_Line;
  15.  
  16.    --  Writes out all the arguments using the Argument function.
  17.    --  (BE CAREFUL because if the number you pass to Argument is not
  18.    --   in the range 1 .. Argument_Count you will get Constraint_Error!)
  19.    for I in 1 .. Ada.Command_Line.Argument_Count loop
  20.       Put ("             Argument ");
  21.       Put (I);
  22.       Put (": ");
  23.       Put (Ada.Command_Line.Argument (I));
  24.       New_Line;
  25.    end loop;
  26. end Test_CL;
  27.